home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo 1.0.1 / UMouseDocument.cp < prev    next >
Encoding:
Text File  |  1992-07-15  |  1.6 KB  |  71 lines  |  [TEXT/MPS ]

  1. //     UMouseDocument.cp 
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMouseDocument member functions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11. // INCLUDES
  12. #ifndef __MOUSEDOCUMENT__
  13. #include "UMouseDocument.h"                                    // class definitions
  14. #endif
  15.  
  16.  
  17. //    CLASS METHODS 
  18. //    Empty constructor - for avoiding ptabs in global data space
  19. #pragma segment ARes
  20. TMouseDocument::TMouseDocument()
  21. {
  22. }
  23.  
  24.  
  25. //    Create TMouseDocument
  26. #pragma segment AInit
  27. pascal void TMouseDocument::IMouseDocument()
  28. {
  29.     inherited::IDocument();
  30. }
  31.  
  32.  
  33. //    Free any resources attached to the TMouseDocument - yes it's empty, but one never
  34. //    knows if one could place something here, so I have it added. Yes, it wastes CPU
  35. //    cycles...
  36. #pragma segment AClose
  37. pascal void TMouseDocument::Free()
  38. {
  39.     inherited::Free();
  40. }
  41.  
  42.  
  43. //    Create any needed TMouseDocument Views
  44. #pragma segment AOpen
  45. pascal void TMouseDocument::DoMakeViews(Boolean    /*forPrinting*/)
  46. {
  47.     TWindow * aWindow = NULL;
  48.     FailInfo fi;
  49.  
  50.     if (fi.Try())
  51.     {
  52.         // create main information window    
  53.         aWindow = (TWindow *)gViewServer->NewTemplateWindow(kMainWindow, this);
  54.         fMainView = (TView *)aWindow->FindSubView('vie1');
  55.  
  56.         // add frame adorner for the document
  57.         fMainView->AddAdorner(NewStdAdorner('afra', "", 'afra', kFreeOnDeletion), kDrawView, kRedraw);
  58.  
  59.         //    add mouse tracking behaviors
  60.         TMouseTrackBehavior * theBehavior = new TMouseTrackBehavior;
  61.         theBehavior->IMouseTrackBehavior(mMouseTrack);
  62.         this->AddBehavior(theBehavior);
  63.  
  64.         fi.Success();
  65.     }
  66.     else
  67.         fi.ReSignal();
  68. }
  69.  
  70.  
  71.